<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var arr=[98,31,5,27,2,78];
			console.log("排列数组"+arr);
			for (var i=1;i<=arr.length;i++) {
				for (var j=0;j<=arr.length;j++) {
					if(arr[j]>arr[i]){
						var temp=arr[i];
						arr[j]=arr[j+1];
						arr[j+1]=temp;
					}
					
				}
				
			}
			console.log("排列后数组"+arr);
		</script>
	</body>
</html>
